package com.zyg.druid;

import com.zyg.utils.DataSourceUtil;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

public class DruidTest02 {
    public static void main(String[] args) throws Exception{
        Connection connection = DataSourceUtil.getConnection();
        String sql = "SELECT * FROM student";
        PreparedStatement preparedStatement = connection.prepareStatement(sql);
        ResultSet rs = preparedStatement.executeQuery();
        while (rs.next()){
            System.out.println(rs.getInt("sid") + "\t" + rs.getString("name") + "\t" + rs.getInt("age") + "\t" + rs.getDate("birthday"));
        }
        DataSourceUtil.close(connection,preparedStatement,rs);
    }
}
